

#include "BltInfo.h"

namespace Graphics
{	
	BltInfo::BltInfo(void):
		m_Opacity(1.0f),
		m_Angle(0),
		m_Tone(0x00,0x00,0x00,0x00),
		m_BlendType(BLEND_ALPHA),
		m_Color(0x00,0x00,0x00,0x00)
	{
		for(int i=0;i<4;i++)
		{
			m_Diffuse[i].Set(0xff,0xff,0xff,0xff);
		}
	}
	BltInfo::~BltInfo(void)
	{
	}

	// Get/Set the color value
	void BltInfo::SetColor(const Color& color)
	{
		m_Color = color;
	}
	const Color& BltInfo::GetColor(void) const
	{
		return m_Color;
	}
	// Get/Set the tone value
	void BltInfo::SetTone(const Color& color)
	{
		m_Tone = color;
	}
	const Color& BltInfo::GetTone(void) const
	{
		return m_Tone;
	}
	// Get the diffuses value
	Color* const BltInfo::GetDiffuse() const
	{
		return (Color* const)m_Diffuse;
	}

	// Get/Set the type of blending
	BLEND_TYPE BltInfo::GetBlendType(void) const
	{
		return m_BlendType;
	}
	void BltInfo::SetBlendType(BLEND_TYPE type)
	{
		m_BlendType = type;
	}
	byte BltInfo::GetOpacity() const
	{
		return (byte)(m_Opacity * 255);
	}
	int BltInfo::GetAngle() const
	{
		return m_Angle;
		//return (int)(m_Angle * 180.0f / 3.14f);
	}
	float BltInfo::GetOpacityF() const
	{
		return m_Opacity;
	}
	float BltInfo::GetAngleF() const
	{
		return m_Angle * 3.14f / 180.0f;
	}
	void BltInfo::SetOpacity(byte opacity)
	{
		if(opacity>=0)
		{
			m_Opacity = opacity / 255.0f;
		}
	}
	void BltInfo::SetAngle(int angle)
	{
		if(angle>=-180 && angle <= 180)
		{
			m_Angle = angle;
		}
	}
	void BltInfo::SetOpacityF(float opacity)
	{
		if(opacity>=0)
		{
			m_Opacity = opacity;
		}
	}
	void BltInfo::SetAngleF(float angle)
	{
		if(angle>=-3.14f && angle <= 3.14f)
		{
			m_Angle = (int)(angle * 180.0f / 3.14f);
			//m_Angle = angle;
		}
	}
}